///*
// * test_frameheader.cpp
// *              -- test functionality of frame header
// *
// * Author: Qiu Shuang
// * Date: Mar 2nd, 2011
// */
//#include <stdio.h>
//#include "MPEGFile.h"
//#include "MPEGFrameHeader.h"
//#include "MPEGSideInfo.h"
//#include "MPEGFeature.h"
//#include "metadata.h"
//
//#include "time.h"
//
//int main(){
//    MPEGFile *origin = new MPEGFile("apologize.mp3", true);
//    //file->nextFrame();
//    //file->nextFrame();
//    //const unsigned char *header_buf = file->headerBuffer();
//    //printf("layout %x %x %x %x\n", header_buf[0], header_buf[1],
//    //                               header_buf[2], header_buf[3]);
//    //MPEGFrameHeader *header = new MPEGFrameHeader(header_buf);
//    /*if(!((header->synchCode() == 0xfff) &&
//         (header->version() == MPEG1) &&
//         (header->layerCode() == LAYER3) &&
//         (header->errorProtected() == 1) &&
//         (header->bitRateInx() == 9) &&
//         (header->samplingFreqInx() == 0) &&
//         (header->paddingFlag() == 0) &&
//         (header->modeFlag() == 1) &&
//         (header->modeExt() == 2) &&
//         (header->copyright() == 0) &&
//         (header->original() == 1) &&
//         (header->emphasisFlag() == 0))){
//             printf("decoded error\n");
//    }
//    MPEGSideInfo *side = new MPEGSideInfo(file->mpeg());*/
//    MPEGFeature *feature = new MPEGFeature(origin);
//    feature->block(22);
//    feature->extractFeature();
//
//    MPEGFile *snippet = new MPEGFile("apologize_cut.mp3", true);
//    MPEGFeature *sub_feature = new MPEGFeature(snippet);
//    sub_feature->block(22);
//    sub_feature->extractFeature();
//    time_t begin, end;
//    struct tm *local_time;
//
//    time(&begin);
//    local_time = localtime(&begin);
//    printf("begin time and date: %s\n", asctime(local_time));
//
//    int i;
//    for(i = 0; i < 10000; i++)
//        feature->search(sub_feature, 0);
//
//    time(&end);
//    local_time = localtime(&end);
//    printf("begin time and date: %s\n", asctime(local_time));
//
//    printf("done");
//
//    //printf("feature match at %d\n", feature->search(sub_feature, 0));
//
//    //feature->extractFeature();
//
//#ifdef DEBUG
//    //side->printSideInfo();
//#endif
//
//    getc(stdin);
//
//    //delete header;
//    //delete side;
//    delete origin;
//    delete feature;
//
//    //delete snippet;
//    //delete sub_feature;
//}